package com.jiantong.user.enums;

/**
 * Created by mz on 5/7/17.
 *
 */
public enum  UserAreaLevel {

    PROVINCE(1,"省级"),
    CITY(2,"市级"),
    REGION(3,"县级"),
    STREET(4,"镇级"),
    VILLAGE(5,"村级");

    private final Integer value;
    private final String description;

    UserAreaLevel(Integer value, String description){
        this.value = value;
        this.description = description;
    }

    public static UserAreaLevel from(Integer value) {
        for (UserAreaLevel userAreaLevel : UserAreaLevel.values()) {
            if (userAreaLevel.value.equals(value)) {
                return userAreaLevel;
            }
        }
        return null;
    }

    public Integer value() {
        return this.value;
    }

    @Override
    public String toString() {
        return description;
    }
}
